home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 17
/
CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso
/
S
/
CUCDprefs.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-07-21
|
6KB
|
154 lines
/* Load, save CUCD prefs for CUCDprefs.mrx */
VerStr = '$VER: CUCDprefs 1.0 (19.6.97) Neil Bothwick'
VerStr = subword(VerStr,2)
options results
arg action
PrefsFile = 'IDer.prefs'
DefPrefs = 'CUCD:S/IDer.prefs'
types = 'IFF GIF JPG ANM MPG SVX WAV S3M XMM MED MOD MP3 MID AGD HTM LHA DEF'
address CDPREFS
/* ;;; Select action */
select
when action = 'SAVE' then do
call SavePrefs()
'quit'
end
when action = 'USE' then do
call UsePrefs()
'quit'
end
when action = 'READ' then do
Prefs = 'ENV:'PrefsFile
call LoadPrefs()
end
when action = 'LOAD' then do
Prefs = 'ENVARC:'PrefsFile
call LoadPrefs()
end
when action = 'RESTORE' then do
Prefs = DefPrefs
call LoadPrefs()
end
when action = 'ABOUT' then call AboutPrefs()
otherwise nop
end
;;;
exit
/* ;;; Load prefs */
LoadPrefs:
if ~exists(Prefs) then Prefs = DefPrefs
if ~open(prefs,Prefs,'R') then do
request ID FAIL title '"CU Amiga CD preferences"' gadgets 'OK' '"Failed to read preferences file"'
quit
exit
end
PrefsLine = readln(prefs)
setvar CfgVersion PrefsLine
do until eof(prefs)
PrefsLine = readln(prefs)
if PrefsLine = '' then iterate
if pos(left(PrefsLine,1),';#') > 0 then iterate
PrefsLine = substr(PrefsLine,pos('CLASS=',upper(PrefsLine)) + 6)
if left(PrefsLine,1) = '"' then parse var Prefsline '"' Class '"' PrefsLine /*Class = substr(PrefsLine,2,pos('"',PrefsLine,2) - 2)*/
else parse var PrefsLine Class PrefsLine
PrefsLine = strip(PrefsLine)
parse var PrefsLine Defn 'ACTION=' Action
interpret Class'.cmd="'word(Action,1)'"'
interpret Class'.arg="'subword(Action,2)'"'
end
popasl ID IFF0 CONTENT IFF_Picture.cmd
popasl ID GIF0 CONTENT GIF_Picture.cmd
popasl ID JPG0 CONTENT JPEG_Picture.cmd
popasl ID ANM0 CONTENT ANIM.cmd
popasl ID MPG0 CONTENT MPEG_Video.cmd
string ID IFF1 CONTENT IFF_Picture.arg
string ID GIF1 CONTENT GIF_Picture.arg
string ID JPG1 CONTENT JPEG_Picture.arg
string ID ANM1 CONTENT ANIM.arg
string ID MPG1 CONTENT MPEG_Video.arg
popasl ID SVX0 CONTENT IFF_Sample.cmd
popasl ID WAV0 CONTENT WAV_Sample.cmd
popasl ID S3M0 CONTENT S3M_Module.cmd
popasl ID XMM0 CONTENT XM_Module.cmd
popasl ID MED0 CONTENT MED_Module.cmd
popasl ID MOD0 CONTENT Module.cmd
popasl ID MP30 CONTENT MPEG_Audio.cmd
popasl ID MID0 CONTENT MIDI.cmd
string ID SVX1 CONTENT IFF_Sample.arg
string ID WAV1 CONTENT WAV_Sample.arg
string ID S3M1 CONTENT S3M_Module.arg
string ID XMM1 CONTENT XM_Module.arg
string ID MED1 CONTENT MED_Module.arg
string ID MOD1 CONTENT Module.arg
string ID MP31 CONTENT MPEG_Audio.arg
string ID MID1 CONTENT MIDI.arg
popasl ID AGD0 CONTENT Guide.cmd
popasl ID HTM0 CONTENT HTML.cmd
popasl ID LHA0 CONTENT LhA_Archive.cmd
popasl ID DEF0 CONTENT Default.cmd
string ID AGD1 CONTENT Guide.arg
string ID HTM1 CONTENT HTML.arg
string ID LHA1 CONTENT LhA_Archive.arg
string ID DEF1 CONTENT Default.arg
return
;;;
/* ;;; Use prefs */
UsePrefs:
do i = 1 to words(types)
type = word(types,i)
interpret 'popasl ID' type'0'
interpret type '= result'
interpret 'string ID' type'1'
interpret type '= strip('type' result)'
end
if ~open(prefs,'ENV:'PrefsFile,'W') then request ID FAIL title '"CU Amiga CD preferences"' gadgets 'OK' '"Failed to save preferences"'
else do
call writeln(prefs,'# IDer Prefs file - created by CUCD prefs'||'0a'x)
call writeln(prefs,'# IDer -- © 1995 Eclipse Software'||'0a'x)
call writeln(prefs,'CLASS=IFF_Picture OFFSET=0,"FORM????ILBM" ACTION='IFF)
call writeln(prefs,'CLASS=GIF_Picture SUFFIX=.GIF OFFSET=0,"GIF87a" ACTION='GIF)
call writeln(prefs,'CLASS=JPEG_Picture OFFSET=6,4A464946 ACTION='JPG)
call writeln(prefs,'CLASS=ANIM SUFFIX=.ANIM OFFSET=0,"FORM????ANIM" ACTION='ANM)
call writeln(prefs,'CLASS=MPEG_Video SUFFIX=.MPG ACTION='MPG)
call writeln(prefs,'CLASS=Module SUFFIX=.MOD NAME=MOD.#? OFFSET=1080,"M.K." FLAGS=T ACTION='MOD)
call writeln(prefs,'CLASS=MPEG_Audio NAME=(#?.MP3|#?.MP2) FLAGS=I ACTION='MP3)
call writeln(prefs,'CLASS=MIDI SUFFIX=.MID OFFSET=0,"MThd" ACTION='MID)
call writeln(prefs,'CLASS=S3M_Module SUFFIX=.S3M NAME=S3M.#? OFFSET=44,"SCRM" FLAGS=T ACTION='S3M)
call writeln(prefs,'CLASS=XM_Module SUFFIX=.XM OFFSET=0,"Extended Module:" FLAGS=I ACTION='XMM)
call writeln(prefs,'CLASS=MED_Module SUFFIX=.MED NAME=MED.#? OFFSET=0,"MMD?" ACTION='MED)
call writeln(prefs,'CLASS=IFF_Sample OFFSET=0,"FORM????8SVX" ACTION='SVX)
call writeln(prefs,'CLASS=WAV_Sample OFFSET=0,"RIFF????WAVE" ACTION='WAV)
call writeln(prefs,'CLASS=Guide SUFFIX=.GUIDE OFFSET=0,"@database" FLAGS=I ACTION='AGD)
call writeln(prefs,'CLASS=HTML NAME=(#?.html|#?.htm) FLAGS=I ACTION='HTM)
call writeln(prefs,'CLASS=LhA_Archive NAME=(#?.LhA|?#.Lzh) OFFSET=2,"-lh?-" ACTION='LHA)
call writeln(prefs,'CLASS=Default ACTION='DEF)
call writeln(prefs,'0a'x||'#END')
call close(prefs)
end
return
;;;
/* ;;; Save prefs */
SavePrefs:
call UsePrefs()
address command 'copy >NIL: ENV:'PrefsFile 'ENVARC:'
return
;;;
/* ;;; Show about requester */
AboutPrefs:
request title '"CU Amiga CD preferences"' gadgets '"OK"' string VerStr'\nCreated using MUIRexx 3.0'
return
;;;